package com.myTest.demo.controller;

import com.myTest.demo.service.IDemoService;
import com.myTest.mvcFramework.annotations.WskSecurity;
import com.myTest.mvcFramework.annotations.WskAutowired;
import com.myTest.mvcFramework.annotations.WskController;
import com.myTest.mvcFramework.annotations.WskRequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WskController
@WskRequestMapping("/demo")
@WskSecurity(value = {"admin","wsk"})
public class DemoController {

    @WskAutowired
    private IDemoService demoService;

    @WskRequestMapping("/handle00")
    public String handle00(HttpServletRequest request, HttpServletResponse response,String name){
        return demoService.get(name);
    }

    @WskRequestMapping("/handle01")
    @WskSecurity("admin")
    public String handle01(HttpServletRequest request, HttpServletResponse response,String username){
        return demoService.get(username);
    }

    @WskRequestMapping("/handle02")
    @WskSecurity("wsk")
    public String handle02(HttpServletRequest request, HttpServletResponse response,String username){
        return demoService.get(username);
    }

    @WskRequestMapping("/handle03")
    @WskSecurity("notName")
    public String handle03(HttpServletRequest request, HttpServletResponse response,String username){
        return demoService.get(username);
    }
}
